package com.sinosoft.app.entrust.biz.imp;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinosoft.app.entrust.biz.EntrustOrderBiz;
import com.sinosoft.app.entrust.dao.EntrustOrderDao;
import com.sinosoft.app.entrust.entity.EntrustOrder;
import com.sinosoft.system.util.page.Pagenation;

@Service
@Transactional
public class EntrustOrderBizImp implements EntrustOrderBiz{

	private static Logger log = Logger.getLogger(EntrustOrderBizImp.class);
	
	@Autowired
	private EntrustOrderDao entrustOrderDao;
	
	@Override
	public int insertEntrustOrder(EntrustOrder entrustOrder) {
		log.info("新增EntrustOrder数据"+entrustOrder.toString());
		return entrustOrderDao.insertEntrustOrder(entrustOrder);
	}

	@Override
	public int updateEntrustOrder(EntrustOrder entrustOrder) {
		log.info("更新EntrustOrder数据"+entrustOrder.toString());
		return entrustOrderDao.updateEntrustOrder(entrustOrder);
	}

	@Override
	public int deleteEntrustOrder(int id) {
		log.info("删除EntrustOrder数据 id="+id);
		return entrustOrderDao.deleteEntrustOrder(id);
	}

	@Override
	public EntrustOrder selectEntrustOrder(int id) {
		log.info("根据ID查询EntrustOrder数据 id="+id);
		return entrustOrderDao.selectEntrustOrder(id);
	}

	@Override
	public EntrustOrder selectEntrustOrder(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询EntrustOrder数据 ");
		return entrustOrderDao.selectEntrustOrder(queryKeys, queryValues);
	}

	@Override
	public int selectCountEntrustOrder() {
		log.info("查询EntrustOrder数据 总数量");
		return entrustOrderDao.selectCountEntrustOrder();
	}

	@Override
	public int selectCountEntrustOrder(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询EntrustOrder数据 总数量"+queryKeys.toString());
		return entrustOrderDao.selectCountEntrustOrder(queryKeys, queryValues);
	}

	@Override
	public List<EntrustOrder> selectLimitEntrustOrder(int start, int size) {
		log.info("查询EntrustOrder数据 limit数量:start="+start+",size="+size);
		return entrustOrderDao.selectLimitEntrustOrder(start, size);
	}

	@Override
	public List<EntrustOrder> selectLimitEntrustOrder(List<String> queryKeys,List<Object> queryValues,int start, int size) {
		log.info("条件查询EntrustOrder数据数量");
		return entrustOrderDao.selectLimitEntrustOrder(queryKeys, queryValues, start,  size);
	}

	@Override
	public List<EntrustOrder> selectAllEntrustOrder() {
		log.info("查询所有EntrustOrder数据");
		return entrustOrderDao.selectAllEntrustOrder();
	}

	@Override
	public List<EntrustOrder> selectAllEntrustOrder(List<String> queryKeys,List<Object> queryValues) {
		log.info("条件查询所有EntrustOrder数据");
		return entrustOrderDao.selectAllEntrustOrder(queryKeys, queryValues);
	}

	@Override
	public Pagenation selectPageEntrustOrder(Pagenation page) {
		log.info("分页查询所有EntrustOrder数据");
		int start =	page.getStartRow();
		int size = page.getPageSize();
		List<EntrustOrder> rows = entrustOrderDao.selectLimitEntrustOrder(page.getQueryKeys(), page.getQueryValues(),start,size);
		int total = entrustOrderDao.selectCountEntrustOrder(page.getQueryKeys(), page.getQueryValues());
		page.setTotal(total);
		page.setRows(rows);
		return page;
	}

	public EntrustOrderDao getEntrustOrderDao() {
		return entrustOrderDao;
	}

	public void setEntrustOrderDao(EntrustOrderDao entrustOrderDao) {
		this.entrustOrderDao = entrustOrderDao;
	}

}
